var ui_locale = 'zh_CN';
var default_img = 'http://www.baidu.com//favicon.ico';
var _config = {
    version: 100,
    lang: "en",
    skins: {
        skin_cloud: {
            style: {},
            csspath: "",
            icon: ""
        },
        skin_local: {
            style: {},
            csspath: "",
            icon: ""
        }
    },
    style: {
        bodyBackground: {
            "background": "-webkit-gradient(linear, 0% 0%, 0% 100%, from(#0866A4), to(#4DA9E8))"
        },
        background: {
            "background-repeat": "no-repeat",
            "background-position": "center",
            "-webkit-background-size": "",
            "-webkit-transform": ""
        }
    },
    skin: "",
    dialBoxNum: 8,
    dialBoxOpacity: 1,
    dialBoxSpacing: 30,
    dialBoxWidth: 262,
    dialBoxHeight: 180,
    dialBoxRadius: 10,
    dialBoxPage: 1,
    toolSwitch: false,
    toolsBoxSwitch: false,
    searchSwitch: false,
    calendarSwitch: false,
    ipSwitch: false,
    weatherSwitch: false,
    openSwitch: true,
    targetSwitch: true,
    helpSwitch: true,
    dialBoxTitleSwitch: false,
    appSwitch: true,
    userSwitch: false,
    dialBoxPageSwitcher: false,
    dialBoxCreateBoxSwitch: false,
    hotQueue: ['skins'],
    bookMarksOpenQueue: [],
    oauthid: "",
    oauthData: {},
    curTab: "home",
    searchType: "",
    city: "",
    passwd: "",
    msgid: "0",
    OTime: 0
};

var _configList = {
    zh_CN: {
        lang: "zh_CN",
        dialBoxes: {
            webSite: [{
                "title": "\u8c37\u6b4c",
                "url": "www.google.com.hk"
            },
            {
                "title": "\u767e\u5ea6",
                "url": "www.baidu.com"
            },
            {
                "title": "\u4f18\u9177",
                "url": "www.youku.com"
            },
            {
                "title": "\u65b0\u6d6a\u5fae\u535a",
                "url": "www.weibo.com"
            },
            {
                "title": "\u6dd8\u5b9d",
                "url": "www.taobao.com"
            },
            {
                "title": "\u4eac\u4e1c",
                "url": "www.360buy.com"
            },
            {
                "title": "\u4e9a\u9a6c\u900a",
                "url": "www.amazon.cn"
            },
            {
                "title": "\u5f53\u5f53",
                "url": "www.dangdang.com"
            },
            {
                "title": "\u5929\u732b",
                "url": "www.tmall.com"
            },
            {
                "title": "\u805a\u5212\u7b97",
                "url": "ju.taobao.com"
            },
            {
                "title": "\u51e1\u5ba2",
                "url": "www.vancl.com"
            },
            {
                "title": "\u6dd8\u5e97\u94fa",
                "url": "dianpu.tao123.com"
            },
            {
                "title": "\u571f\u8c46",
                "url": "www.tudou.com"
            },
            {
                "title": "\u7231\u5947\u827a",
                "url": "www.iqiyi.com"
            },
            {
                "title": "\u4eba\u4eba\u7f51",
                "url": "www.renren.com"
            }],
            app: [{
                "id": "webstore",
                "title": getI18nMsg('appChromeWebStore'),
                "url": "https://chrome.google.com/webstore?hl=zh-CN",
                "img": default_img
            }]
        }
    }
};

var favicons = {
    "www.google.com.hk": {
        "rgb": "22,105,250"
    },
    "www.baidu.com": {
        "rgb": "0,0,255"
    },
    "www.youku.com": {
        "rgb": "243,1,1"
    },
    "www.weibo.com": {
        "rgb": "244,11,24"
    },
    "www.taobao.com": {
        "rgb": "232,70,8"
    },
    "www.360buy.com": {
        "rgb": "233,153,38"
    },
    "www.amazon.cn": {
        "rgb": "244,142,9"
    },
    "www.dangdang.com": {
        "rgb": "0,148,105"
    },
    "www.tmall.com": {
        "rgb": "191,0,0"
    },
    "ju.taobao.com": {
        "rgb": "222,77,58"
    },
    "dianpu.tao123.com": {
        "rgb": "232,70,8"
    },
    "www.vancl.com": {
        "rgb": "153,28,28"
    },
    "www.tudou.com": {
        "rgb": "251,86,0"
    },
    "www.iqiyi.com": {
        "rgb": "130,169,13"
    },
    "www.renren.com": {
        "rgb": "0,93,172"
    }
};

var config = _configList[ui_locale];
if (typeof config != 'undefined') {
    $.each(config,function(i, n) {
        _config[i] = n
    })
}
var screenWidth = window.screen.width, screenHeight = window.screen.height; 
var user = $.user();
var h5Storage = new $.h5Storage(),
	PDI = $.pdi(),
	myBox,
	oauthBox,
	version = "version",
	ver = _config.version,
	tabID = '',
	serverValue = [],
	protocol = 'chrome',
	setupDialog = '';

$(function() {
    var targetSwitch = PDI.get('setup', 'targetSwitch') ? "_self": "_blank";
    myBox = $('.appDialbox').dialbox({
        num: PDI.get('setup', 'dialBoxNum'),
        page: PDI.get('setup', 'dialBoxPage'),
        opacity: PDI.get('setup', 'dialBoxOpacity'),
        spacing: PDI.get('setup', 'dialBoxSpacing'),
        titleShow: PDI.get('setup', 'dialBoxTitleSwitch'),
        pageSwitcherShow: PDI.get('setup', 'dialBoxPageSwitcher'),
        createBoxShow: PDI.get('setup', 'dialBoxCreateBoxSwitch'),
        width: PDI.get('setup', 'dialBoxWidth'),
        height: PDI.get('setup', 'dialBoxHeight'),
        radius: PDI.get('setup', 'dialBoxRadius')        
    });
	$("body").css("background","-webkit-gradient(linear, 0% 0%, 0% 100%, from(#686868), to(#5A5A5A))");
});